<script src="__PUBLIC__/js/jquery.datePicker-min.js" type="text/javascript"></script>
<link href="__PUBLIC__/js/datePicker.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__ROOT__/Public/js/FCKeditor/fckeditor.js"></script>
<script language="JavaScript" type="text/javascript">
$(document).ready(function(){
	$("#typeid").change(function(){
		var id=this.value;
		ch_type(id);
	});
	$('.showend_job').datePicker({clickInput:true});
	var typeid=$("#typeid").val();
	if(typeid!=0){
		ch_type(typeid);
	}
	$("#add_ltd").click(function(){
		var title=$("#ltdtitle").val();
		if(title){
			var tourl=URL+'/ajax_add_ltd';
			$.post(tourl,{title:title},function(data){
				if(data['status']==1){
					var t="<option value='"+data[data]+"' selected='selected'>"+title+"</option>";
					$("#ltdid").append(t);
					alert(data['info']);
				}else{
					alert(data['info']);
				}
			},'json')
		}
	});
});
function ch_type(id){
	id=id.split('_');
	var cache=$("#cache").html();
	id="#channel_"+id['0'];
	if(id!=cache){
		$("#channel").html($(id).html());
		$("#cache").html(id);
	}
}
function zone(obj,id,name){
	if(name==0){
		var cid=obj.options[obj.options.selectedIndex].value;
	}else{
		var cid=obj.options[obj.options.selectedIndex].className;
	}
	$(id).load(URL+'/ajax_zone',{cid:cid,types:'localion',name:name});
}
</script>
<div class="mulu">
	<a href="__APP__/">Home</a> > <a href="__APP__/Cp/index">Control Panel</a> > 
	<a href="__APP__/Cp/event_my_post">My Event </a>
</div>
<div class="right-neirong">
    <div class="clear">
    </div>
    <div class="right-messages">
        <div class="right-title">
            <h3 style="margin:0;">Create/Edit My Event</h3>
        </div>
        <div class="list">
            <form action="__URL__/event_add" method="post" enctype="multipart/form-data">
            	<if condition="$data['id']"><input type="hidden" name="id" value="{$data['id']}"></if>
            	<p>
            	<strong>Step 1: Fill in the information and submit it. </strong><br>
            	<strong>Step 2: </strong>Add picture(s) and finish the post. <br>
            	<strong>Step 3: </strong><a href="__APP__/Cp/event_my_post">Back to the list</a>. 
            	</p>
            	<fieldset>
				<legend>Basic Elements:</legend>
	            	<p>
	            		<label for="title">*Title:</label><input type="text" name="title" id="title" value="{$data['title']}" style="width:300px;">
					</p>
					<p><label for="showend_job">*Valid for</label>
						<input type="text" name="showstart" id="showend_job" class="showend_job" value="{$data['showstart']|toDate='d/m/Y'}" style="width:80px;">
						---> <input type="text" name="showend" id="showend_job" class="showend_job" value="{$data['showend']|toDate='d/m/Y'}" style="width:80px;">
					</p>
					<!--p><label for="deadline">报名开始时间</label>
						<input type="text" name="deadline" id="deadline" class="showend_job" style="width:80px;">
					</p>
					<p><label for="starttime">活动开始时间</label>
						<input type="text" name="starttime" id="starttime" class="showend_job" style="width:80px;">
					</p>
					<p><label for="endtime">活动结束时间</label>
						<input type="text" name="endtime" id="endtime" class="showend_job" style="width:80px;">
					</p-->
					<p>
						<label for="position">*Venue:</label>
						<select name="city_id" class="city_id" onchange="zone(this,'.zone_id',0)">
							<option value="0">--Select City--</option>
							<volist name="citylist" id="v">
							<option value="{$v['id']}"{$v['id']|selected=$data['city_id']}>{$v['ctitle']}</option>
							</volist>
						</select>
						<select name="zone_id" class="zone_id">
							<option value="0">--Select District--</option>
                            <volist name="citylist[$data['city_id']]['_zone']" id="v">
								<option value="{$v['id']}"{$v['id']|selected=$data['zone_id']}>{$v['name']}</option>
							</volist>
						</select>
						<input type="text" name="position" id="position" value="{$data['position']}">
						
					</p>
                    
                    <if condition="$data['maps']"><p>Mpas:{$data['maps']}</p>
                    <input type="hidden" name="old_maps" value="{$data['maps']}" />
                    </if>
					<p>
						<label for="cid">*By City</label>
						<select name="cid" id="cid">
							<option value="0">--Favorite City--</option>
							<volist name="citylist" id="v">
							<option value="{$v['id']}"{$v['id']|selected=$data['cid']}>{$v['ctitle']}</option>
							</volist>
						</select>
					</p>
				</fieldset>
				<fieldset>
				<legend>Select Category:</legend>
					<p>
						<label for="typeid">*Category:</label>
						<select id="typeid" name="typeid">
							<option value="0">---Select Category---</option>
							<volist name="class_tree" id="v">
								<if condition="$v['ispart'] eq 1">
									<optgroup label="{$v['typename']}">
										<volist name="v['_son']" id="vs">
											<option value="{$v['channeltype']}_{$vs['id']}"{$vs['id']|selected=$data['typeid']}>{$vs['typename']}</option>
										</volist>
									</optgroup>
								<else/>
									<option value="{$v['channeltype']}_{$v['id']}"{$v['id']|selected=$data['typeid']}>{$v['typename']}</option>
								</if>
														
							</volist>
						</select>
					</p>
					<!--p>
						<label for="typeid2">Second<br>Category:</label>
						<select id="typeid2" name="typeid2" size="5" >
							<option value="0">---Select Second Category---</option>
							<volist name="class_tree" id="v">
								<if condition="$v['ispart'] eq 1">
									<optgroup label="{$v['typename']}">
										<volist name="v['_son']" id="vs">
											<option value="{$vs['id']}">{$vs['typename']}</option>
										</volist>
									</optgroup>
								<else/>
									<option value="{$v['id']}">{$v['typename']}</option>
								</if>
														
							</volist>
						</select>
					</p-->
				</fieldset>
				<fieldset>
					<legend>Event info:</legend>
					
					<p><label for="telephone">Telephone:</label>
						<input type="text" name="telephone" id="telephone" value="{$data['telephone']}">
					</p>
					<p><label for="fax">Fax:</label>
						<input type="text" name="fax" id="fax" value="{$data['fax']}">
					</p>
					<p><label for="mobphone">Mobile:</label>
						<input type="text" name="mobphone" id="mobphone" value="{$data['mobphone']}">
					</p>
					<p><label for="email">E-mail:</label>
						<input type="text" name="email" id="email" value="{$data['email']}">
					</p>
					<p><label for="msn">Msn:</label>
						<input type="text" name="msn" id="msn" value="{$data['msn']}">
					</p>
					<p><label for="oicq">QQ:</label>
						<input type="text" name="oicq" id="oicq" value="{$data['oicq']}">
					</p>
					<p><label for="linkman">Contact:</label>
						<input type="text" name="linkman" id="linkman" value="{$data['linkman']}">
					</p>
					<p><label for="contact">Address:</label>
						<input type="text" name="contact" id="contact" style="width:300px;" value="{$data['contact']}">
					</p>
					<p><label for="detail">*Detail:</label>
						<!-- 编辑器调用开始 -->
						<textarea id="editor_editor" rows="8" cols="50" name="detail">{$data['content']['detail']|br2nl}</textarea>
						<!--script type="text/javascript">
						var id="editor_editor";
						var oFCKeditor = new FCKeditor(id,"100%","445px" );
						oFCKeditor.BasePath = "__ROOT__/Public/js/FCKeditor/";
						oFCKeditor.ReplaceTextarea();
						function resetEditor(){
							setContents(id,document.getElementById(id).value)
						};
						function saveEditor(){
							document.getElementById(id).value = getContents(id);
						}
						function InsertHTML(html){
							var oEditor = FCKeditorAPI.GetInstance(id);
							if (oEditor.EditMode == FCK_EDITMODE_WYSIWYG ){
								oEditor.InsertHtml(html);
								}else
									alert( "WYSIWYG Model" );
						}</script-->
						<!-- 编辑器调用结束 -->
					</p>
				</fieldset>
				<p>
					<input type="submit" value="Submit">            
					<input type="reset" value="Reset">            
				</p>
            </form>
        </div>
    </div>
</div>
<div class="clear"></div>


